#!/usr/bin/env python

from text_page_class import TextPage

def list ( liwe ):
	"""
	:INPUT:

	:xPERMS:
		- admin

	"""

	tp = TextPage ( liwe )
	return { "text_pages" : tp.list () }

def create ( liwe, title, text, id_page = 0, id_page_man = 0, tags = '' ):
	"""
	:INPUT:
		- title:	SAFE_DB_STRING
		- text:		SAFE_HTML
		- id_page:	SAFE_NUMBER [0]
		- id_page_man:	SAFE_NUMBER [0]
		- tags:		SAFE_DB_STRING
	"""
	tp = TextPage ( liwe )
	id_page = tp.add ( title, text, id_page, id_page_man, tags )

	return { "id_page" : id_page }
	
def delete ( liwe, id_page ):
	"""
	:INPUT:
		- id_page:              SAFE_NUMBER
	"""

	tp = TextPage ( liwe )
	tp.delete ( id_page )

	return { "status": 'ok' }
